package com.itheima.bos.web.action.take_delivery;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import com.itheima.bos.domain.take_delivery.Order;
import com.itheima.bos.service.take_delivery.IOrderService;
import com.itheima.bos.web.action.common.BaseAction;

public class OrderAction extends BaseAction<Order>{
	
	@Autowired
	private IOrderService orderService;
	
	@Action(value="order_findByOrderNum",results={@Result(name="success",type="json")})
	public String findByOrderNum(){
		Map<String, Object> result = new HashMap<String, Object>();
		//调用webserivce
		Order order=orderService.findByOrderNum(model.getOrderNum());
		//判断订单是否存在
		if(order==null){
			result.put("success", false);
		}else{
			result.put("success", true);
			result.put("orderData", order);
		}
		pushPageDataToValueStack(result);
		return SUCCESS;
	}
}
